﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using EntityAndDomainLibrary.DomainModel;
using EntityAndDomainLibrary.EntityModel;
using Log4NetLibrary;

namespace MeterServiceClientApp.UC
{
    public partial class ucMeterData : UserControl
    {
        #region Private Variable
        private DataBaseAccess dbaccess;
        ILogService logService; 
        #endregion

        public ucMeterData()
        {
            try
            {
                log4net.Config.XmlConfigurator.Configure();
                logService = new FileLogService(typeof(ucMeterData));

                InitializeComponent();
            }

            catch (Exception ex)
            {
                logService.Error(ex.Message);
            }
        }

        public void LoadData(MeterDataDisplayed data)
    
        {
            try
            {
                lblMeterName.Text = data.MeterName;
                lblImpwhValue.Text = data.ImpwH.ToString() + " " + "ImpWh";

                lblExpwhValue.Text = data.ExpwH.ToString() + " " + "ExpWh";
                lblImpvarhValue.Text = data.ImpVarH.ToString() + " " + "ImpVarh";

                lblExpvarhValue.Text = data.ExpVarH.ToString() + " " + "ExpVarh";
            }


            catch (Exception ex)
            {
                logService.Error(ex.Message);
            }
        }
    }
}
